"""vote2003 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

from polls.views import show_index, show_teachers, make_comment, login, logout, register, check_unique, report, \
    export_excel, get_bar_data, SubjectView, get_mobilecode, upload

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', show_index),
    # path('subjects/', show_subjects),
    path('subjects/', SubjectView.as_view()),
    path('teachers/', show_teachers),
    path('praise/', make_comment),
    path('criticize/', make_comment),
    path('login/', login),
    path('logout/', logout),
    path('register/', register),
    path('check/', check_unique),
    path('report/', report),
    path('export/', export_excel),
    path('bar/', get_bar_data),
    path('mobilecode/<str:tel>/', get_mobilecode),
    path('upload/', upload)
]

# # ModelViewSet需要通过注册路由的方式来配置URL映射
# router = DefaultRouter()
# router.register('subjects', SubjectViewSet)
# urlpatterns += router.urls
